###
 # @Description:
 # @Author: stone
 # @Date: 2020-02-01 08:44:51
 # @LastEditTime: 2020-05-23 14:02:42
 # @LastEditors: stone
 ###
#!/bin/bash

increment_version ()
{
  declare -a part=( ${1//\./ } )
  declare    new
  declare -i carry=1
 
  for (( CNTR=${#part[@]}-1; CNTR>=0; CNTR-=1 )); do
    len=${#part[CNTR]}
    new=$((part[CNTR]+carry))
    [ ${#new} -gt $len ] && carry=1 || carry=0
    [ $CNTR -gt 0 ] && part[CNTR]=${new: -len} || part[CNTR]=${new}
  done
  new="${part[*]}"
  echo -e "${new// /.}"
} 
 
version='1.0.0.0'
 
increment_version $version
